<template>
  <div class="Test">
    <input @change="importFileChangeHandle" type="file" accept=".FDB,.TDB" multiple>
    <button @click="addData">添加到数据源</button>
    <ul>
      <li v-for="item in datas" :key="item.id">{{item.name}}</li>
    </ul>
  </div>
</template>

<script type="text/ecmascript-6">

export default {
  name: 'Test',
  components: {},
  props: {},
  data () {
    return {
      userInfo: {
        pwd: 'a94bf0e0f5cc3f2905b68dd28c9f32c9'
      },
      urls: {
        physicalDatasources: 'http://11.23.254.232:8040/rest/services/manageService/physicalDatasources/testfqfy'// 添加数据源
      },
      datas: [
        // {
        //   name: '',
        //   url: ''
        // }
      ]
    }
  },
  methods: {
    physicalDatasources (name) {

    },

    addData () {

    },
    importFileChangeHandle (e) {
      this.datas = []
      let files = e.currentTarget.files
      debugger
      if (files.length) {
        console.log('选中了', files)
        for (let index = 0; index < files.length; index++) {
          let item = files[index]
          let name = item.name
          let url = ''
          this.datas.push({name, url})
        }
      } else {
        console.log('没有选中', files)
      }
    }
  },
  computed: {},
  mounted () {
  },
  destroyed () {
  }
}
</script>
<style scoped>
  .Test {
  }
</style>
